package com.mkyong.utils;

import java.util.Map;

import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

public class JSFUtils {
	
	public static String getRequestParam(String param) {
		FacesContext fc = FacesContext.getCurrentInstance();
		Map<String,String> params = fc.getExternalContext().getRequestParameterMap();
		return params.get(param);
	}
	
	public static Object getSessionParam(String param) {
		FacesContext fc = FacesContext.getCurrentInstance();
		Map<String,Object> params = fc.getExternalContext().getSessionMap();
		return params.get(param);
	}


	public static UIViewRoot getViewRoot() {
		FacesContext fc = FacesContext.getCurrentInstance();
		return fc.getViewRoot();
	}
	


}
